package com.nervenets.web.hibernate.dao;

import com.nervenets.web.hibernate.domain.Preordain;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PreordainDao extends JpaRepository<Preordain, Long>, JpaSpecificationExecutor<Preordain> {
    List<Preordain> findAllByManagerIdAndBuildingId(long managerId, long buildingId);

    Preordain findTop1ByBuildingIdAndUserId(long buildingId, long userId);
}
